﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BizControl.Library.Security;
using Csla;
using System.ComponentModel.Composition;
using BizControl.Presentation.Infrastructure.Constants;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using BizControl.Library.BusinessObjects;
using BizControl.Presentation.Shell.ViewModels;

namespace BizControl.Presentation.Shell
{
  [Export]
  public partial class Shell : Window
  {
    public Shell()
    {
      InitializeComponent();
    }

    [ImportingConstructor]
    public Shell(ShellViewModel viewModel)
      : this()
    {
      this.DataContext = viewModel;
    }

    private void Window_Closed(object sender, EventArgs e)
    {
      if (App.IsLoggingOut)
        App.RunInReleaseMode();
      else
        App.Current.Shutdown();
    }
  }
}
